from model.Hero import Hero
from model.blocks.Block import Block
from view.blockImgs.BlockImg import BlockImg
from view.blockImgs.Text import Text


class StateImg(BlockImg):
    def __init__(self):
        BlockImg.__init__(self, "resources/素材/magic_attack0 3.png", 0, 0)
        self.img_list = [
            BlockImg("resources/勇者/down 0.png", 1.5, 1.25),
            BlockImg("resources/字/等级.png", 3.5, 0.75, 1.2),
            BlockImg("resources/字/体力.png", 2.1, 2),
            BlockImg("resources/字/攻击.png", 2.1, 3),
            BlockImg("resources/字/防御.png", 2.1, 4),
            BlockImg("resources/道具/16.png", 1.5, 9.5),
            BlockImg("resources/道具/17.png", 1.5, 10.5),
            BlockImg("resources/道具/18.png", 1.5, 11.5),
            BlockImg("resources/道具/31.png", 1.5, 12.5),
        ]
        self.levelText = Text(3.7, 0.75, size=22)
        self.hpText = Text(3.2, 2.1, size=30)
        self.atkText = Text(3.2, 3.1, size=30)
        self.defText = Text(3.2, 4.1, size=30)
        self.yellowKeyText = Text(2.2, 9.1, size=30)
        self.purpleKeyText = Text(2.2, 10.1, size=30)
        self.redKeyText = Text(2.2, 11.1, size=30)
        self.moneyText = Text(2.2, 12.1, size=30)

    def update(self):
        print(self.yellowKeyText.text)
        self.levelText.text = Hero.level.__str__()
        self.hpText.text = Hero.hp.__str__()
        self.atkText.text = Hero.attack.__str__()
        self.defText.text = Hero.defense.__str__()
        self.yellowKeyText.text = Hero.yellowKey.__str__()
        self.purpleKeyText.text = Hero.purpleKey.__str__()
        self.redKeyText.text = Hero.redKey.__str__()
        self.moneyText.text = Hero.money.__str__()
